home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 011 / ddos2aid.arc / PRIORITY.ASM < prev    next >
Encoding:
Assembly Source File  |  1985-12-21  |  7.4 KB  |  210 lines

  1.            PAGE    62,132 
  2.            Title   DoubleDOS Utility: Partition Priority 
  3.  
  4. CR                 EQU     0Dh     ;ASCII Carriage Return
  5. LF                 EQU     0Ah     ;ASCII Line Feed
  6. $                  EQU     24h     ;String termination charachter '$'
  7.  
  8. Parm_Byte_Count    EQU     80h
  9.  
  10. Dos_Call           EQU     21h
  11. Terminate_Process  EQU     4Ch
  12. Put_String         EQU     09h
  13.  
  14. DD_Set_Timeshare   EQU     0E9h    ;Set timesharing priority
  15.  
  16. ;  AL = 0 Visible program gets 70% Invisible gets 30% (Default)
  17. ;  AL = 1 Visible program gets 50% Invisible gets 50% of time  
  18. ;  AL = 2 Visible program gets 30% Invisible gets 70% of time  
  19. ;  AL = 3 Top     program gets 70% Bottom    gets 30% of time
  20. ;  AL = 4 Top     program gets 30% Bottom    gets 70% of time
  21. ;
  22. ;  Priority / - [V,I,E,T,B]
  23. ;
  24. ;  Calling sequence: /, or - optional.  The timesharing ratio will be
  25. ;    set according to the first valid parameter charachter:
  26. ;
  27. ;         V - Visible    partition       gets 70%
  28. ;         E - Equal      both partitions get  50%
  29. ;         I - Invisible  partition       gets 70%
  30. ;         T - Top        partition       gets 70%
  31. ;         B - Bottom     partition       gets 70%
  32. ;
  33.  
  34. Print_$    MACRO
  35.            mov     ah,Put_String
  36.            int     Dos_Call
  37.            ENDM
  38.  
  39. Code_Seg   SEGMENT 
  40.            ASSUME  cs:Code_Seg,ds:Code_Seg,es:Code_Seg
  41.            ORG     0100h  
  42. Main       PROC    NEAR
  43.  
  44.  
  45. ; Get parameter Byte count, copy parameters into buffer, converting
  46. ;   to Upper case as we go.
  47.  
  48.            mov     si,Parm_Byte_Count            ;Point to parm byte count 
  49.            mov     di,OFFSET Parm_Copy           ;point to copy destination
  50.            cld                                   ;  String Counts forward
  51.            lodsb                                 ;  AL = Byte Count
  52.  
  53.            mov     Parm_Count,al                 ;Store Byte Count 
  54.            mov     dx,OFFSET Prog_Info           ;Display program info
  55.            PRINT_$
  56.            mov     al,Parm_Count                 ;Restore Byte Count
  57.  
  58.  
  59. ; Some quick error checks: 0 < Parm_Count < 128
  60.  
  61.            cmp     al,00h
  62.            jnz     Not_Err1                      ;No parms given?
  63.  
  64.            mov     dx,OFFSET Err_Msg1
  65.            Print_$
  66.            mov     dx,OFFSET Valid
  67.            Print_$
  68.            mov     Ret_Code,31h                  ;Return ERRORLEVEL 1
  69.            jmp     Finished
  70.  
  71. Not_Err1:  test    al,80h
  72.            jz      Not_Err2                      ;More than 127 bytes?
  73.  
  74.            mov     dx,OFFSET Err_Msg2
  75.            Print_$
  76.            mov     dx,OFFSET Valid
  77.            Print_$
  78.            mov     Ret_Code,32h                  ;Return ERRORLEVEL 2
  79.            jmp     Finished                      
  80.  
  81. ; End of Error checks, move and convert.
  82.  
  83. Not_Err2:  cbw                                   ;AX = Byte Count
  84.            mov     cx,ax                         ;CX = Loop count
  85.            cld 
  86. Up_Loop:   lodsb                                 ;Copy parms into buffer
  87.            cmp     al,60h                        ;  converting to UPPER
  88.            jb      Up_Case                       ;  case as we go
  89.            sub     al,20h
  90. Up_Case:   stosb
  91.            loop    Up_Loop
  92.  
  93.  
  94. ; Scan Parameters list for 1st occurence of a valid parameter, and
  95. ;   execute appropriate subroutine when found.
  96.  
  97.            mov     si,OFFSET Parm_Copy
  98.            mov     al,Parm_Count
  99.            cbw
  100.            mov     cx,ax
  101. Next_Char: cld
  102.            lodsb                                 ;Look for valid parm char
  103.            cmp     al,'V'                                           
  104.            jz      Vis_Ok                        ;  Priority = Visible
  105.            cmp     al,'E'                                           
  106.            jz      Equ_Ok                        ;  Priority = Equal
  107.            cmp     al,'I'                                           
  108.            jz      Inv_Ok                        ;  Priority = Invisible
  109.            cmp     al,'T'                                           
  110.            jz      Top_Ok                        ;  Priority = Top
  111.            cmp     al,'B'                                               
  112.            jz      Bot_Ok                        ;  Priority = Bottom
  113.            loop    Next_Char
  114.  
  115.            mov     dx,OFFSET Err_Msg3            ;No valid parms found!
  116.            Print_$
  117.            mov     dx,OFFSET Valid
  118.            Print_$
  119.            mov     Ret_Code,33h                  ;Return ERRORLEVEL 3
  120.            jmp     Finished                      
  121.  
  122.  
  123. ; A valid parameter has been found.  Set up AL, and set new timesharing
  124. ;   ratio.  A User message will be output, and an ERRORLEVEL of 0 will 
  125. ;   be returned. 
  126.  
  127. Vis_Ok:    mov     dx,OFFSET Vis_Msg             ;Set-up  Timeshare parms
  128.            Print_$
  129.            mov     al,00h
  130.            jmp     Kosher
  131.  
  132. Equ_Ok:    mov     dx,OFFSET Equ_Msg
  133.            Print_$
  134.            mov     al,01h
  135.            jmp     Kosher
  136.  
  137. Inv_Ok:    mov     dx,OFFSET Inv_Msg
  138.            Print_$
  139.            mov     al,02h
  140.            jmp     Kosher
  141.  
  142. Top_Ok:    mov     dx,OFFSET Top_Msg
  143.            Print_$
  144.            mov     al,03h
  145.            jmp     Kosher
  146.  
  147. Bot_Ok:    mov     dx,OFFSET Bot_Msg
  148.            Print_$
  149.            mov     al,04h
  150.  
  151. Kosher:    mov     ah,DD_Set_Timeshare           ;Set Timesharing Ratio
  152.            int     Dos_Call
  153.            mov     Ret_Code,30h                  ;All Kosher, end program
  154.            jmp     Finished                      ;Return ERRORLEVEL 0
  155.  
  156.  
  157. ;//////////////////
  158. ;
  159. ;  ERRORLEVEL return, Output to user, Terminate
  160. ;
  161. ;//////////////////
  162.  
  163. Finished:  mov     dx,OFFSET Finish_Msg          ;Display ERRORLEVEL MSG
  164.            PRINT_$
  165.            mov     ah,Terminate_Process          ;End Program
  166.            mov     al,Ret_Code                   ;ERRORLEVEL in AL
  167.            and     al,0Fh                        ;Ascii to binary integer
  168.            int     Dos_Call
  169.  
  170.  
  171. ;//////////////////
  172. ;
  173. ;  Data Definition Area
  174. ;
  175. ;//////////////////
  176.  
  177. Prog_Info  DB      CR,LF,'DoubleDOS Utility - by Chris M. Magyar '
  178.            DB      '- 12/20/85',CR,LF,CR,LF,$
  179.  
  180. Vis_Msg    DB      'Partition Priority: Visible 70%, Invisible 30%',CR,LF,$
  181. Equ_Msg    DB      'Partition Priority: Both Partions recieve 50%',CR,LF,$
  182. Inv_Msg    DB      'Partition Priority: Invisible 70%, Visible 30%',CR,LF,$
  183. Top_Msg    DB      'Partition Priority: Top 70%, Bottom 30%',CR,LF,$
  184. Bot_Msg    DB      'Partition Priority: Bottom 70%, Top 30%',CR,LF,$
  185.  
  186. Finish_Msg DB      CR,LF,'ERRORLEVEL : '
  187. Ret_Code   DB      ?,' being returned.',CR,LF,$
  188.  
  189. Err_Msg1   DB      'No parameters given.',CR,LF,CR,LF,$
  190. Err_Msg2   DB      'More than 127 bytes in parameter list!!!',CR,LF
  191.            DB      'Must terminate now.',CR,LF,CR,LF,$
  192. Err_Msg3   DB      'No valid parameters given.',CR,LF,CR,LF,$
  193.  
  194. Valid      DB      'The following are valid parameters for Priority'
  195.            DB      CR,LF,CR,LF
  196.            DB      '  V - Visible   partion gets 70% Priority',CR,LF
  197.            DB      '  I - Invisible partion gets 70% Priority',CR,LF
  198.            DB      '  T - Top       partion gets 70% Priority',CR,LF
  199.            DB      '  B - Bottom    partion gets 70% Priority',CR,LF
  200.            DB      '  E - Equal     each partition gets 50% Priority'
  201.            DB      CR,LF,$
  202.  
  203. Parm_Count DB      ?
  204. Parm_Copy  DB      128 DUP(?),CR,LF,$
  205.  
  206. Main       ENDP
  207. Code_Seg   ENDS
  208.            END Main
  209.  
  210.